package hn.sigit.git.model;

import hn.sigit.model.ladm.administrative.LA_RightType;
import hn.sigit.model.ladm.spatialunit.LA_VolumeValue;
import hn.sigit.model.ladm.special.Rational;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Type;
import org.hibernate.annotations.Columns;

import com.vividsolutions.jts.geom.Point;


@Entity
@Table(name = "cities", schema = "spatialtest")
public class Cities {
	private int gid;
	private String cityName;
	private Rational share;
	private LA_RightType type;
	private LA_VolumeValue volumeValue;
	//private Point theGeom;
	
	@Id
	@Column(name = "gid", unique = true, nullable = false)
	@GeneratedValue
	public int getGid() {
		return gid;
	}
	public void setGid(int gid) {
		this.gid = gid;
	}
	
	@Column(name = "city_name", nullable = false)
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	
	@Type(type = "hn.sigit.model.ladm.special.RationalUserType")
	@Columns(columns = {
			@Column(name = "share_numerator"),
			@Column(name = "share_denominator")
	})
	public Rational getShare() {
		return share;
	}
	public void setShare(Rational share) {
		this.share = share;
	}
	
	@Column(name = "type")
	@Enumerated(EnumType.STRING)
	public LA_RightType getType() {
		return type;
	}
	public void setType(LA_RightType type) {
		this.type = type;
	}
	
	@Columns(columns = {
			@Column(name = "volumeValue_volumeType"),
			@Column(name = "volumeValue_volumeSize")
	})
	@Type(type = "hn.sigit.model.ladm.spatialunit.LA_VolumeValueUserType")
	public LA_VolumeValue getVolumeValue() {
		return volumeValue;
	}
	public void setVolumeValue(LA_VolumeValue volumeValue) {
		this.volumeValue = volumeValue;
	}

	
	
	/*
	@Column(name = "the_geom")
	@Type(type = "org.hibernatespatial.GeometryUserType")
	public Point getTheGeom() {
		return this.theGeom;
	}
	public void setTheGeom(Point theGeom) {
		this.theGeom = theGeom;
	}
	*/
}
